import request from '@/utils/request'

const ArticleApi = {
    Article: '/api/v1/article/list',
    ArticleDetail: '/api/v1/article',
    ArticleCreate: '/api/v1/article/create',
    ArticleModify: '/api/v1/article/modify',
    ArticleDelete: '/api/v1/article/delete',
}

//获取文章列表
export const GetArticle = () => {
    return request({
        url: ArticleApi.Article,
        method: 'get',
    })
}

//获取文章详情内容
export const GetArticleDetail = (data) => {
    return request({
        url: ArticleApi.ArticleDetail + "/" + data,
        method: 'get',
        param: {id: data},
    })
}

//添加文章
export const CreateArticle = (data) => {
    return request({
        url: ArticleApi.ArticleCreate,
        method: 'post',
        data: data,
    })
}

//修改文章内容
export const ModifyArticle = (data) => {
    return service({
        url: ArticleApi.ArticleModify,
        method: 'put',
        data: data
    })
}

//删除文章列表
export const deleteUser = (data) => {
    return service({
        url: ArticleApi.ArticleDelete,
        method: 'delete',
        data: data
    })
}